import java.util.ArrayList;

/**
 * Created by asus on 2017/9/22.
 */
public class Bag<T> implements Baginterface<T> {

    private ArrayList<T> mArraylist = new ArrayList<>();



    @Override
    public int getCurrentSize() {
        return mArraylist.size();
    }

    @Override
    public boolean isEmpty() {

        if (mArraylist.size()==0){
        return false;}
        else
            return true;
    }

    @Override
    public boolean add(T newEntry) {

        mArraylist.add(newEntry);

        return false;

    }

    @Override
    public T remove() {
        if (mArraylist!=null) {
            mArraylist.remove(mArraylist.size() - 1);
            return null;
        }
        else{
        return null;}
    }

    @Override
    public boolean remove(T anEntry) {

       mArraylist.remove(anEntry);

        return false;
    }

    @Override
    public void clear() {
        mArraylist.clear();
    }

    @Override
    public int getFrequencyOf(T anEntry) {
        if (mArraylist.contains(anEntry)==true){
        return 0;}
        else return 1;
    }
    public void getFrenquency(T anEntry){

        if (getFrequencyOf(anEntry)==0){
            System.out.println("Bag has it");
        }
       else
           System.out.println("Bag doesn't have it");

    }


    @Override
    public boolean contains(T anEntry) {

        return false;
    }
}
